<template>
  <view class="dynamic-details">
    <RcNavigation title="最新动态" border />
    <view v-if="info">
      <view class="head">
        <view class="title">{{ info.title }}</view>
        <view class="text">
          <text>{{ timeFormat(info.createtime * 1000) }}</text>
        </view>
      </view>
      <view class="content" v-html="info.content"></view>
    </view>
    <up-empty v-else mode="data"></up-empty>
  </view>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import RcNavigation from '@/components/navigation.vue'
import { timeFormat } from '@/utils/utils'
const info = ref({})
async function getDetail(id: string) {
  const res = await uni.$u.get("/dongtai/info", { id })
  info.value = res.data
}
onLoad((e) => {
  getDetail(e.id)
})
</script>
<style lang="scss" scoped>
.dynamic-details {
  padding: 0 25rpx;

  .head {
    padding-top: 40rpx;
    margin-bottom: 30rpx;

    .title {
      font-weight: bold;
      font-size: 34rpx;
      color: #333333;
      text-align: center;
      margin-bottom: 30rpx;
    }

    .text {
      font-weight: 500;
      font-size: 26rpx;
      color: #999999;
      line-height: 45rpx;
      display: flex;
      justify-content: space-between;
    }
  }

  .content {
    font-weight: 500;
    font-size: 30rpx;
    color: #333333;
    line-height: 45rpx;
  }
}
</style>